Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

381
Vistas
Is this possible to do with RangeNames in GSheet Appscript? I get this error: "TypeError: sheet.getRangeByName is not a function"

I am trying to add some static range names to an object in AppScript, I do this to have more flexibility since there are more than 20 variables (columns) and so that if you try to add a column in the google sheet, the code is not damaged, this is a simplified example of what I already have coded:

var sheet = SpreadsheetApp.getActive().getSheetByName('Form Responses');

var bot_id = sheet.getRangeByName("bot_id");

var elements = {
  bot_id: bot_id,
}

var res = elements.bot_id.getValues();

However, when I run it I get the following error: "TypeError: sheet.getRangeByName is not a function".

How can I fix it and always be referencing to the same sheet, is there another easier and more efficient way to do it?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

getRangeByName() is not a method of Sheet but instead of Spreadsheet. So you should try:

var bot_id = SpreadsheetApp.getActiveSpreadsheet().getRangeByName("bot_id");
about 4 years ago · Juan Pablo Isaza Denunciar

0

Try it this way:

function lfunko() {
  const ss = SpreadsheetApp.getActive()
  const sh = ss.getSheetByName('Sheet0');
  var bot_id = ss.getRangeByName("bot_id");
  Logger.log(JSON.stringify(bot_id.getValues()));
}
  • getRangeByName()
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda